﻿using B.Auth.APi.Application.Command.Users;
using B.Auth.Domain.Entity;
using B.Auth.Domain.Repository;
using B.Auth.Enum;
using MediatR;

namespace B.Auth.APi.Application.CommandHand
{
    public class GetProvincecommandHand : IRequestHandler<GetProvincecommand, ApiResult<List<Province>>>
    {
        private readonly IBaseRepository<Province> db;

        public GetProvincecommandHand(IBaseRepository<Province> db)
        {
            this.db = db;
        }

        public Task<ApiResult<List<Province>>> Handle(GetProvincecommand request, CancellationToken cancellationToken)
        {
            var result=new ApiResult<List<Province>>();
            var show = db.GetAll();
            result.data=show.ToList();
            return Task.FromResult(result);
            
        }
    }
}
